#!/bin/bash
if [[ ! $BIN ]]; then
	BIN='dstorm'
fi

function check_file() {
	if [ -e $BINARY ]; then
		./$BINARY "$@"
	else
		echo "$BINARY does not exist. Please compile Dretchstorm first to play."
		exit 1
	fi
}

case `uname -m` in
	x86_64)
		BINARY="$BIN.x86_64"
		check_file "$@";
		;;
	amd64)
		BINARY="$BIN.amd64"
		check_file "$@";
		;;
	i386|i486|i586|i686)
		BINARY="$BIN.i386"
		check_file "$@";
		;;
	powerpc|powerpc64)
		BINARY="$BIN.ppc"
		check_file "$@";
		;;
	"*")
		echo "You are not running a supported platform for playing Dretchstorm. If you would like to play Dretchstorm on your platform, please visit http://dretchstorm.com for contact information."
		exit 0
		;;	
esac
